﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplication2.Models.HomeModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <%--<h2>Sản phẩm</h2>--%>
    <table width="100%" border="1" bordercolor="#999999" cellspacing="0" cellpadding="0" style="border-collapse: collapse">
        <tr>
            <td>Trang
            <% for (int i = 1; i <= Model.SoTrang; i++)
               {
            %>
                <%=Html.ActionLink(i.ToString(),"Index","Home",new {trang=i,idLoaiSanPham=!string.IsNullOrEmpty(Request.Params["idLoaiSanPham"])
                                     ? Convert.ToInt32(Request.Params["idLoaiSanPham"])
                                     : 4},null) %>
                <%
               } %> 
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%" border="1" bordercolor="#999999" cellspacing="0" cellpadding="0" style="border-collapse: collapse">
                    <% foreach (var sanPham in Model.SanPhamList)
                       {
                    %>
                    <tr>
                        <td width="20%">
                            <img width="100%" alt="HinhAnh" src='<%=Url.Content("~/Content/Images/"+sanPham.HinhAnh) %>' />
                        </td>
                        <td>
                            <ul>
                                <li>Tên sản phẩm: <b><%= sanPham.TenSanPham %></b></li>
                                <li>Giá bán: <b><%= sanPham.Gia %></b></li>
                                <li>Số lượng tồn: <b><%= sanPham.SoLuong %></b></li>
                                <li>Điểm thưởng khi mua: <b><%= sanPham.DiemThuong %></b></li>
                                <li>Điểm thưởng để đổi: <b><%= sanPham.DiemNhanThuong %></b></li>
                                <% if (Request.IsAuthenticated)
                                   { %>
                                <li><%= Html.ActionLink("Đặt mua", "DatMua", "Product", new {idSanPham = sanPham.Id}, null) %></li>
                                <% if(sanPham.DiemNhanThuong!=null)
                                   { %>
                                <li><%= Html.ActionLink("Đổi thưởng", "DoiThuong", "Product", new {idSanPham = sanPham.Id}, null) %></li>
                                <% } %>
                                <% } %>
                            </ul>
                        </td>
                    </tr>
                    <%
                       } %>
                </table>
            </td>
        </tr>
    </table>
    <%--<%= ViewData["a"] %>
    <%= Html.ActionLink("Click","Demo","Demo") %>
    <% using (Html.BeginForm("UploadFile", "Home", FormMethod.Post, new { enctype="multipart/form-data"}))
       { %>
       <p><input type="file" name="file" id="file" /></p>
       <p><input type="submit" value="Upload" /></p>
    <%} %>--%>
</asp:Content>
